package hasthi.common.constants;

import java.util.regex.Pattern;

import javax.xml.namespace.QName;
public class HasthiConstants {
    public static enum MngState{
        Started,HasCoordinatorJoined,HasCoordinatorNotJoined,NoCoordWithoutElection,NoCoordWithElection
    };
    
    public static enum CoordState{
        OnlyManager, Nominated, Coordinator
    };
    
    public static enum ActMonMethods{Polling,JMX,SNMP,Process}
    
    
    public static final String NOMINATION_REQUEST_ACTION = "http://extreme.indiana.edu/managment/NominationRequest";
    public static final String EXECUATE_COMMAND_ACTION = "http://extreme.indiana.edu/managment/ExecuateCommand";
    public static final String ELECTED_NOTICE_ACTION = "http://extreme.indiana.edu/managment/ElectedNotice";
    public static final String ELECTION_CANCEL_NOTICE_ACTION = "http://extreme.indiana.edu/managment/ElectionCancelNotice";
    public static final String COORDINATOR_HEARTBEAT_ACTION = "http://extreme.indiana.edu/managment/CoordinatorHeartbeat";
    public static final String GET_COORDINATOR_ACTION = "http://extreme.indiana.edu/managment/GetCoordinator";
    public static final String ASSIGN_RESOURCE_ACTION = "http://extreme.indiana.edu/managment/AssignResource";
    public static final String ASSIGN_RESOURCE_RESPONSE_ACTION = "http://extreme.indiana.edu/managment/AssignResourceResponse";
    public static final String UNASSIGN_RESOURCE_ACTION = "http://extreme.indiana.edu/managment/UnAssignResource";
    public static final String GET_RESOURCES_ACTION = "http://extreme.indiana.edu/managment/GetResources";
    public static final String LIST_RESOURCES_ACTION = "http://extreme.indiana.edu/managment/ListResources";
    public static final String GET_RESOURCES_HOLDER_ACTION = "http://extreme.indiana.edu/managment/GetResourceHolders";
    public static final String LIST_ALL_RESOURCES_ACTION = "http://extreme.indiana.edu/managment/ListAllResources";
    public static final String MANAGE_ME_ACTION = "http://extreme.indiana.edu/managment/ManageMe";

    public static final String JOIN_MANAGMENT_RING_ACTION = "http://extreme.indiana.edu/managment/JoinManagementRing";
    public static final String SELF_ADDRESS = "http://extreme.indiana.edu/managment/SelfAddress";
    public static final String GET_LIVEMANEGERS_ACTION = "http://extreme.indiana.edu/managment/GetLiveManagers";
    public static final String MANAGER_HEARTBEAT_ACTION = "http://extreme.indiana.edu/managment/ManagerHeartbeat";
    public static final String GET_COORDINATOR_STATE_ACTION = "http://extreme.indiana.edu/managment/GetCoordinatorState";
    public static final String NEWCOORDINATOR_INVITATION_ACTION = "http://extreme.indiana.edu/managment/NewCoordinatorInvitation";
    public static final String RESOURCE_MONITORING_REQUEST_ACTION = "http://extreme.indiana.edu/managment/ResourceMonitoringRequest";
    public static final String NOTIFY_ERROR_ACTION = "http://extreme.indiana.edu/managment/NotifyError";
    public static final String SUSPECT_FAULTY_ACTION = "http://extreme.indiana.edu/managment/SuspectFaulty";
    

    public static final String SHUTDOWN_OPERATION_NAME = "ShutDown";
    public static final String MANAGER_PING_ACION = "http://extreme.indiana.edu/managment/ManagerPing";
    public static final String USER_INTERVENTION_ACTION = "http://extreme.indiana.edu/managment/UserIntervention";
    public static final String BROADCAST_ADDRESS = "BroadcastAddress";

    public static final String MANEGER_NS = "http://extreme.indiana.edu/manager/";
    
    public static final String MANEGER_RESOURCE_NS = "http://extreme.indiana.edu/hasthi/resources/";

    public static final QName BROADCAST_HEADER = new QName(MANEGER_NS, "Broadcast");
    public static final String LOGGER_NAME = "hasthi";
    public static final String AGENT_LOGGER_NAME = "hasthi.agent";
    public static final String UNSPECIFIED_EPR = "http://extreme.indiana.edu/UnspecifiedEndpointReference";

    public static final int MINUTE = 1000 * 60;
    
    public static final String LOG_DIR = "hasthi.logDir";
    public static final String LOG_DIR_ENV = "HASTHI_LOGDIR";
    public static final String PERF_WRITE2FILE = "hasthi.perf.write2file";
    
    
    public static final String FAULT_DETAIL_CURRENT_COORDINATOR = "CurrentCoordinator";
    public static final String FAULT_DETAIL_CURRENT_COORDINATOR_VAL_RETRY = "RetryNextEpoch";
    
    public static final String FAULTCODE_COORDINATOR_MSG_RECIVEDBY_NONCOORDINATOR = "A coordinator message received by Non Coordinator";
    
    
    public static final String LABEL_TRIGGER_EVENT = "triggerEvent";
    public static final String RESOLVE_DEPENDANCY_LABEL = "ResolveServiceDependancy";
    public static final String EXECUATE_QUERY_LABEL = "ExecuteQuery";
    
    public static final String NOTIFY_ERROR = "NotifyError";
    public static final String NOTIFY_ERROR_ERRORDESC = "error";
    
    public static final QName MEMEORY_USAGE = new QName(WSDMConstants.EXTREME_MANAGEMENT_NS,"MemeoryUsage");
    public static final QName THREAD_COUNT = new QName(WSDMConstants.EXTREME_MANAGEMENT_NS,"ThreadCount");
    
    public static final String RESOURCE_PREFIX = "/hasthi/resource/";
    public static final String SYSTEM_STATUS_PREFIX = "hasthi/systemStatus";
    public static final Pattern PUBLIC_HTML_PATTERN = Pattern.compile(".*/hasthi/public/(.*)");
    public static final Pattern FORWARD_HTML_PATTERN = Pattern.compile(".*/hasthi/forward/(.*?)/(.*)");
    public static final Pattern EXECUTE_QUERY_PATTERN = Pattern.compile("(.*)\\((.*)\\)");
    public static final int HOST_AGENT_PORT = 5003;
    
    public static final QName MNGHB_NAME = new QName(MANEGER_NS,"ManagerHeartbeat");
    public static final QName MNGHBRES_NAME = new QName(MANEGER_NS,"ManagerHeartBeatResponse");
    public static final QName MNGMEREQ_NAME = new QName(MANEGER_NS,"ManageMeRequest");
    
    public static final String UNKONWN_VALUE = "Unkonwn";
    
    public static interface Actions{
        public static String CONTAINER_TOMCAT = "tomcat";
        public static String COMMAND_TOMCAT_START = "tomcat:start";
        public static String COMMAND_TOMCAT_STOP = "tomcat:stop";
        public static String COMMAND_PROCESS_KILL = "processkill:";

    }
           
}
